//
//  QRCodeViewController.m
//  MagicBox
//
//  Created by dllo on 16/8/16.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "QRCodeViewController.h"
#import "WoDeViewController.h"

@interface QRCodeViewController ()

@end

@implementation QRCodeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // ********       扫一扫
    
    // Do any additional setup after loading the view.
   self.navigationItem.title = self.qrCode;
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(NSNAction:) name:@"weizhi" object:nil];

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:button];
    button.frame = CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT);
    button.backgroundColor = [UIColor whiteColor];
    [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel *myLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREENWIDTH * 0.1, SCREENWIDTH * 0.3, SCREENWIDTH * 0.8, SCREENWIDTH * 0.1)];
    myLabel.textAlignment = NSTextAlignmentCenter;
    myLabel.text = @"亲,轻触扫一扫哦";
    [button addSubview:myLabel];
    myLabel.font = [UIFont systemFontOfSize:30];
    
    
    
}
- (void)buttonAction:(UIButton *)button {
    
    WoDeViewController *woDeVC = [[WoDeViewController alloc] init];
    [self.navigationController pushViewController:woDeVC animated:YES];
    
}


-(void)NSNAction:(NSNotification *)nsnotif {
    
    NSString *string = nsnotif.object;
    UIAlertController *alert = [UIAlertController alertControllerWithTitle: string message:@"扫描到以上结果" preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *cation1 = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        
    }];
    
    UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
             
    }];
    
    [alert addAction:cation1];
    [alert addAction:action2];
    
    [self presentViewController:alert animated:YES completion:^{
        
    }];

    
}












@end
